package com.dqp.cslggroup.UI;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.dqp.cslggroup.R;
import com.dqp.cslggroup.bean.Jxj;

import java.util.List;

public class JxjAdapter extends BaseAdapter {
    private List<Jxj> jxjs;
    private LayoutInflater inflater;
    private KjAdapter kjAdapter;

    public JxjAdapter(List<Jxj> jxj, Context context) {
        this.jxjs = jxj;
        this.inflater = LayoutInflater.from(context);
    }

    public int getCount() {
        return jxjs == null ? 0 : jxjs.size();
    }


    public Object getItem(int position) {
        return jxjs.get(position);
    }


    public long getItemId(int position) {
        return position;
    }


    public View getView(int position, View convertView, ViewGroup parent) {
        View view = inflater.inflate(R.layout.grade_list, null);
        Jxj jxj = (Jxj) getItem(position);
        TextView kc = view.findViewById(R.id.text_kc);
        TextView xf = view.findViewById(R.id.text_xf);
        TextView cj = view.findViewById(R.id.text_cj);
        TextView jd = view.findViewById(R.id.text_jd);
        kc.setText(jxj.getXm());
        xf.setText(jxj.getXn());
        cj.setText(jxj.getXq());
        jd.setText(jxj.getZc());
        return view;
    }
}
